// Java program to demonstrate varargs
class VarArgs {
    // A method that takes variable number of integer arguments.
    private static void fun(int ... a){
        System.out.println("Number of arguments: " + a.length);

        for (int i: a)
            System.out.print(i + " ");
        System.out.println();
    }

    public static void main(String args[]){
        // Calling the varargs method with different number of parameters
        fun(100);         // one parameter
        fun(1, 2, 3, 4);  // four parameters
        fun();            // no parameter
    }
}
